<template>
  <div>
    <div id="dplayer" :style="dplayerData.style"></div>
  </div>
</template>

<script>
import DPlayer from "dplayer";
export default {
  name:'dplayer',
  props:{dplayerData: Object},
  data () {
    return {
    }
  },
  mounted() {
    this.dp = new DPlayer({
      container: document.getElementById('dplayer'),// 容器位置
      theme: '#b7daff', //风格颜色
      loop: false, //是否循环
      lang:'zh-cn',
      hotkey: true,
      preload: 'auto',
      mutex: true,
      video:{
        url:'',
        defaultQuality:0,
        img:'',
      },
    })
  },
  created() {
  },
  methods: {
    switchVideo(item) {
      this.dp.switchVideo({
        url:item.url,
        img:item.img,
      })
    },
    pause() {
      this.dp.pause()
    }
  }
}
</script>

<style scoped>

</style>
